/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 工具栏样式 */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
    padding: 8px 16px;
    height: 60px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: #0366d6;
    margin-right: 20px;
}

/* 按钮样式 */
.btn {
    padding: 6px 12px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    background: #fff;
    color: #24292e;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn:hover {
    background: #f6f8fa;
    border-color: #c1c8cd;
}

.btn-primary {
    background: #0366d6;
    color: #fff;
    border-color: #0366d6;
}

.btn-primary:hover {
    background: #0256cc;
    border-color: #0256cc;
}

.btn-secondary {
    background: #f6f8fa;
    border-color: #d1d5da;
}

.btn-toggle {
    border-radius: 0;
    border-right: none;
}

.btn-toggle:first-child {
    border-radius: 6px 0 0 6px;
}

.btn-toggle:last-child {
    border-radius: 0 6px 6px 0;
    border-right: 1px solid #d1d5da;
}

.btn-toggle.active {
    background: #0366d6;
    color: #fff;
    border-color: #0366d6;
}

.btn-icon {
    padding: 6px;
    min-width: 32px;
    justify-content: center;
}

/* 主内容区域 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 250px;
    min-width: 200px;
    max-width: 400px;
    background: #f6f8fa;
    border-right: 1px solid #e1e4e8;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid #e1e4e8;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-title {
    color: #24292e;
}

.sidebar-tools {
    display: flex;
    gap: 4px;
}

.sidebar-content {
    flex: 1;
    overflow: auto;
    padding: 8px;
}

/* 目录树样式 */
.directory-tree {
    font-size: 14px;
    line-height: 1.4;
}

.tree-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #586069;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.tree-item:hover {
    background-color: #e1e4e8;
}

.tree-item.selected {
    background-color: #0366d6;
    color: #fff;
}

.tree-item.directory {
    font-weight: 500;
}

.tree-item.file {
    color: #586069;
}

.tree-item.file.markdown {
    color: #0366d6;
}

.tree-icon {
    margin-right: 6px;
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.tree-expand {
    margin-right: 4px;
    width: 12px;
    text-align: center;
    cursor: pointer;
    font-size: 10px;
    color: #586069;
}

.tree-expand.expanded::before {
    content: '▼';
}

.tree-expand.collapsed::before {
    content: '▶';
}

.tree-expand.leaf {
    visibility: hidden;
}

.tree-children {
    margin-left: 16px;
}

.tree-children.collapsed {
    display: none;
}

/* 错误状态 */
.tree-error {
    padding: 20px;
    text-align: center;
    color: #666;
}

.tree-error .error-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.tree-error .error-message {
    font-size: 14px;
    line-height: 1.4;
}

/* 加载动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tree-loading::before {
    content: "⟳";
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

.panel {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 1px solid #e1e4e8;
}

#editor-panel {
    flex: 1;
    min-width: 400px;
}

#preview-panel {
    flex: 1;
    min-width: 400px;
    border-right: none;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: #f6f8fa;
    border-bottom: 1px solid #e1e4e8;
    height: 40px;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #586069;
}

.editor-tools,
.preview-tools {
    display: flex;
    gap: 4px;
}

.tool-btn {
    padding: 4px 8px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    background: #fff;
    color: #586069;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #f6f8fa;
}

.tool-btn.active {
    background: #0366d6;
    color: #fff;
    border-color: #0366d6;
}

/* 编辑器容器 */
#editor-container,
#preview-container {
    flex: 1;
    overflow: hidden;
}

#markdown-editor {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    background: #fff;
}

#preview-content {
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
}

/* 预览内容样式 */
.welcome-message {
    text-align: center;
    color: #586069;
    margin-top: 60px;
}

.welcome-message h2 {
    color: #24292e;
    margin-bottom: 16px;
}

.welcome-message h3 {
    color: #24292e;
    margin: 24px 0 12px;
}

.welcome-message ul {
    text-align: left;
    display: inline-block;
    margin: 0;
}

.welcome-message li {
    margin: 8px 0;
}

/* 状态栏 */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f6f8fa;
    border-top: 1px solid #e1e4e8;
    padding: 4px 16px;
    height: 28px;
    font-size: 12px;
    color: #586069;
}

.status-left,
.status-right {
    display: flex;
    gap: 16px;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e1e4e8;
}

.modal-header h3 {
    margin: 0;
    color: #24292e;
}

.modal-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section h4 {
    margin-bottom: 12px;
    color: #24292e;
    font-size: 16px;
}

.settings-section label {
    display: block;
    margin-bottom: 8px;
    color: #586069;
    cursor: pointer;
}

.settings-section input,
.settings-section select {
    margin-right: 8px;
}

.settings-section select {
    padding: 4px 8px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    background: #fff;
}

.settings-section input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 14px;
    margin-top: 4px;
}

.setting-description {
    margin-top: 8px;
    margin-bottom: 12px;
}

.setting-description small {
    color: #6a737d;
    font-size: 12px;
    line-height: 1.4;
}

/* PlantUML离线模式样式 */
.plantuml-fallback.offline-mode .offline-notice {
    background-color: #f8f9fa;
    border-left: 4px solid #6c757d;
}

.plantuml-fallback.offline-mode .offline-notice h4 {
    color: #6c757d;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toolbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px;
    }
    
    .toolbar-left,
    .toolbar-center,
    .toolbar-right {
        flex: 1;
        min-width: 200px;
        margin: 4px 0;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    #editor-panel,
    #preview-panel {
        min-width: auto;
        min-height: 300px;
    }
    
    .export-actions {
        flex-wrap: wrap;
        gap: 4px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 工具栏分隔符 */
.tool-separator {
    width: 1px;
    height: 20px;
    background: #e1e4e8;
    margin: 0 8px;
}

/* 数学符号下拉面板 */
.math-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn::after {
    content: '▼';
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.6;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    min-width: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.math-dropdown:hover .dropdown-content,
.math-dropdown.active .dropdown-content {
    display: block;
}

.math-symbols-panel {
    padding: 12px;
}

.symbol-group {
    margin-bottom: 16px;
}

.symbol-group:last-child {
    margin-bottom: 0;
}

.group-title {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #586069;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e1e4e8;
}

.symbol-btn {
    display: inline-block;
    padding: 6px 8px;
    margin: 2px;
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 32px;
    text-align: center;
}

.symbol-btn:hover {
    background: #e1e4e8;
    border-color: #d0d7de;
}

.symbol-btn:active {
    background: #d0d7de;
    transform: translateY(1px);
}

/* KaTeX 错误样式 */
.katex-error {
    color: #d73a49;
    background: #ffeef0;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.katex-display {
    margin: 16px 0;
    text-align: center;
}

/* 数学公式样式增强 */
.katex {
    font-size: 1.1em;
}

.katex-display .katex {
    font-size: 1.2em;
}

/* Mermaid图表样式 */
.mermaid-wrapper {
    position: relative;
    margin: 1em 0;
    padding: 1em;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    background-color: #f8f9fa;
    text-align: center;
}

.mermaid-wrapper[data-mermaid-type="flowchart"] {
    border-left: 4px solid #0366d6;
}

.mermaid-wrapper[data-mermaid-type="sequence"] {
    border-left: 4px solid #28a745;
}

.mermaid-wrapper[data-mermaid-type="class"] {
    border-left: 4px solid #6f42c1;
}

.mermaid-wrapper[data-mermaid-type="state"] {
    border-left: 4px solid #fd7e14;
}

.mermaid-wrapper[data-mermaid-type="gantt"] {
    border-left: 4px solid #20c997;
}

.mermaid-wrapper[data-mermaid-type="pie"] {
    border-left: 4px solid #e83e8c;
}

.mermaid-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mermaid-wrapper:hover .mermaid-toolbar {
    opacity: 1;
}

.mermaid-tool-btn {
    padding: 4px 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d1d5da;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.mermaid-tool-btn:hover {
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.mermaid-error {
    margin: 1em 0;
    padding: 1em;
    border: 1px solid #f85149;
    border-radius: 6px;
    background-color: #ffeaea;
}

.mermaid-error .error-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #d1242f;
}

.mermaid-error .error-icon {
    font-size: 16px;
}

.mermaid-error .error-message {
    color: #656d76;
    margin-bottom: 12px;
}

.mermaid-error .error-details {
    margin-top: 8px;
}

.mermaid-error .error-details summary {
    cursor: pointer;
    color: #0969da;
    font-weight: 500;
}

.mermaid-error .error-details pre {
    margin-top: 8px;
    padding: 8px;
    background-color: #f6f8fa;
    border: 1px solid #d1d5da;
    border-radius: 4px;
    font-size: 12px;
    overflow-x: auto;
}

/* Mermaid模态框样式 */
.mermaid-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mermaid-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.mermaid-modal .modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.mermaid-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.mermaid-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #24292f;
}

.mermaid-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #656d76;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.mermaid-modal .modal-close:hover {
    background: #f3f4f6;
    color: #24292f;
}

.mermaid-modal .modal-body {
    padding: 20px;
    overflow: auto;
    max-height: calc(90vh - 80px);
}

/* 提示消息样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    transform: translateX(0);
}

.toast.toast-success {
    background: #28a745;
}

.toast.toast-error {
    background: #dc3545;
}

.toast.toast-warning {
    background: #ffc107;
    color: #212529;
}

.toast.toast-info {
    background: #17a2b8;
}

/* 账户系统样式 */
.account-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.username {
    font-weight: 500;
    color: #0366d6;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e1e4e8;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #24292f;
}

.modal-header .close {
    font-size: 24px;
    font-weight: bold;
    color: #656d76;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-header .close:hover {
    color: #24292f;
    background-color: #f3f4f6;
}

.modal-body {
    padding: 24px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #24292f;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    line-height: 20px;
    color: #24292f;
    background-color: #fff;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.form-group input:invalid {
    border-color: #d1242f;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e1e4e8;
}

.form-actions .btn {
    min-width: 80px;
}

/* 侧边栏选项卡样式 */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #e1e4e8;
    margin-bottom: 12px;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #656d76;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #24292f;
    background-color: #f3f4f6;
}

.tab-btn.active {
    color: #0969da;
    border-bottom-color: #0969da;
    background-color: #fff;
}

/* 选项卡内容样式 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 登录提示样式 */
.login-prompt {
    text-align: center;
    padding: 40px 20px;
    color: #656d76;
}

.login-prompt p {
    margin-bottom: 16px;
    font-size: 14px;
}

/* 账户文件操作样式 */
.account-file-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid #d0d7de;
    background: #f6f8fa;
    color: #24292f;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: #f3f4f6;
    border-color: #8c959f;
}

/* 文件树项目样式增强 */
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.file-item:hover {
    background-color: #f3f4f6;
}

.file-item.selected {
    background-color: #dbeafe;
    color: #1e40af;
}

.file-item-content {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.file-item-actions {
    display: none;
    gap: 4px;
}

.file-item:hover .file-item-actions {
    display: flex;
}

.file-action-btn {
    padding: 2px 6px;
    font-size: 11px;
    border: none;
    background: transparent;
    color: #656d76;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.file-action-btn:hover {
    background: #e1e4e8;
    color: #24292f;
}

/* 保存下拉菜单样式 */
.save-dropdown {
    position: relative;
    display: inline-flex;
}

.save-dropdown .btn {
    border-radius: 0;
}

.save-dropdown .btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
    border-right: none;
}

.save-dropdown .dropdown-toggle {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    padding: 8px 6px;
    min-width: auto;
    border-left: 1px solid rgba(255,255,255,0.2);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 180px;
    background: white;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
    margin-top: 4px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #24292f;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f6f8fa;
}

.dropdown-item:first-child {
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

.dropdown-item:disabled {
    color: #8c959f;
    cursor: not-allowed;
}

.dropdown-item:disabled:hover {
    background-color: transparent;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e1e4e8;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #24292f;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #e1e4e8;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #24292f;
    font-size: 14px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.form-select {
    cursor: pointer;
}

.form-input:disabled,
.form-select:disabled {
    background: #f6f8fa;
    color: #8c959f;
    cursor: not-allowed;
}

/* TOC (Table of Contents) Styles */
.toc-panel {
    position: fixed;
    top: 60px;
    right: -320px;
    width: 300px;
    height: calc(100vh - 60px);
    background: white;
    border-left: 1px solid #e0e0e0;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.toc-panel.visible {
    right: 0;
}

.toc-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
}

.toc-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.toc-header .btn {
    padding: 4px 8px;
    font-size: 12px;
    margin-left: 8px;
}

.toc-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.toc-list {
    padding: 0;
}

.toc-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

.toc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.toc-item:hover {
    background-color: #f5f5f5;
}

.toc-item.active {
    background-color: #e3f2fd;
    border-left-color: #2196f3;
}

.toc-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toc-line {
    font-size: 11px;
    color: #999;
    margin-left: 8px;
    flex-shrink: 0;
}

.toc-item[data-level="1"] .toc-text {
    font-weight: 600;
    color: #1976d2;
}

.toc-item[data-level="2"] .toc-text {
    font-weight: 500;
    color: #424242;
}

.toc-item[data-level="3"] .toc-text {
    color: #616161;
}

.toc-item[data-level="4"] .toc-text,
.toc-item[data-level="5"] .toc-text,
.toc-item[data-level="6"] .toc-text {
    color: #757575;
    font-size: 13px;
}

/* 当TOC可见时调整主内容布局 */
.main-content.toc-visible {
    margin-right: 300px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .toc-panel {
        width: 280px;
        right: -280px;
    }
    
    .toc-panel.visible {
        right: 0;
    }
    
    .main-content.toc-visible {
        margin-right: 0;
    }
    
    .toc-item {
        padding: 10px 16px;
    }
    
    .toc-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .toc-panel {
        width: 100%;
        right: -100%;
    }
    
    .toc-header {
        padding: 12px 16px;
    }
    
    .toc-item {
        padding: 12px 16px;
    }
}